package com.faith.timefloating.utils;

import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;

public class Common {
	public static final String SHARED_VISIBILITY = "visibility";

	public static String colorToHexString(int color) {
		return String.format("#%06X", 0xFFFFFFFF & color);
	}
	public static String[] getFontSizeArr(){
		String [] sizeArr = new String[15];
		for (int i = 0; i < 15; i++) {
			sizeArr[i] = (i + 9)+"";
		}
		return sizeArr;
	}
	
	public static int getFontIndex(int value){
		int index=0;
		for(int i=0;i<getFontSizeArr().length;i++){
			if(Integer.parseInt(getFontSizeArr()[i])==value){
				index=i;
				break;
			}
		}
		return index;
	}
	
	public static int getFontSizeFromIndex(int index){
		return Integer.parseInt(getFontSizeArr()[index]);
	}
	
	public static String getVersionCode(Context context){
		String versionCode="versionCode";
		try {
			versionCode=(context.getPackageManager().getPackageInfo(context.getPackageName(), 0)).versionCode +"";
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		return versionCode;
	}
}
